/*
 * Copyright (c) 2011-2021 Technosoftware GmbH. All rights reserved
 * Web: https://technosoftware.com
 *
 * Purpose:
 *
 * The Software is subject to the Technosoftware GmbH Software License Agreement,
 * which can be found here:
 * https://technosoftware.com/documents/Technosoftware_SLA.pdf
 */

#include "Base/StatusCodes.h"

namespace Technosoftware
{
    namespace Base
    {
        namespace StatusCodes
        {

            using namespace Technosoftware::Base::StatusCodes;

#define TECHNOSOFTWARE_STATUSCODES_TOSTRING(ERROR)       \
        case ERROR: return #ERROR;


            std::string ToString(StatusCode code)
            {
                switch (code)
                {
                    TECHNOSOFTWARE_STATUSCODES_TOSTRING(Good)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(Uncertain)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadUnexpectedError)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadInternalError)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadOutOfMemory)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadResourceUnavailable)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadCommunicationError)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadEncodingError)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadDecodingError)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadEncodingLimitsExceeded)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadRequestTooLarge)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadResponseTooLarge)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadUnknownResponse)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadTimeout)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadServiceUnsupported)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadShutdown)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadServerNotConnected)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadServerHalted)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadNothingToDo)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadTooManyOperations)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadTooManyMonitoredItems)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadDataTypeIdUnknown)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadCertificateInvalid)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadSecurityChecksFailed)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadCertificateTimeInvalid)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadCertificateIssuerTimeInvalid)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadCertificateHostNameInvalid)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadCertificateUriInvalid)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadCertificateUseNotAllowed)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadCertificateIssuerUseNotAllowed)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadCertificateUntrusted)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadCertificateRevocationUnknown)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadCertificateIssuerRevocationUnknown)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadCertificateRevoked)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadCertificateIssuerRevoked)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadUserAccessDenied)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadIdentityTokenInvalid)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadIdentityTokenRejected)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadSecureChannelIdInvalid)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadInvalidTimestamp)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadNonceInvalid)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadSessionIdInvalid)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadSessionClosed)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadSessionNotActivated)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadSubscriptionIdInvalid)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadRequestHeaderInvalid)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadTimestampsToReturnInvalid)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadRequestCancelledByClient)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(GoodSubscriptionTransferred)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(GoodCompletesAsynchronously)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(GoodOverload)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(GoodClamped)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadNoCommunication)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadWaitingForInitialData)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadNodeIdInvalid)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadNodeIdUnknown)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadAttributeIdInvalid)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadIndexRangeInvalid)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadIndexRangeNoData)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadDataEncodingInvalid)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadDataEncodingUnsupported)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadNotReadable)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadNotWritable)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadOutOfRange)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadNotSupported)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadNotFound)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadObjectDeleted)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadNotImplemented)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadMonitoringModeInvalid)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadMonitoredItemIdInvalid)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadMonitoredItemFilterInvalid)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadMonitoredItemFilterUnsupported)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadFilterNotAllowed)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadStructureMissing)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadEventFilterInvalid)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadContentFilterInvalid)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadFilterOperatorInvalid)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadFilterOperatorUnsupported)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadFilterOperandCountMismatch)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadFilterOperandInvalid)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadFilterElementInvalid)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadFilterLiteralInvalid)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadContinuationPointInvalid)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadNoContinuationPoints)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadReferenceTypeIdInvalid)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadBrowseDirectionInvalid)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadNodeNotInView)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadServerUriInvalid)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadServerNameMissing)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadDiscoveryUrlMissing)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadSempahoreFileMissing)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadRequestTypeInvalid)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadSecurityModeRejected)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadSecurityPolicyRejected)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadTooManySessions)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadUserSignatureInvalid)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadApplicationSignatureInvalid)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadNoValidCertificates)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadIdentityChangeNotSupported)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadRequestCancelledByRequest)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadParentNodeIdInvalid)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadReferenceNotAllowed)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadNodeIdRejected)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadNodeIdExists)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadNodeClassInvalid)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadBrowseNameInvalid)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadBrowseNameDuplicated)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadNodeAttributesInvalid)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadTypeDefinitionInvalid)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadSourceNodeIdInvalid)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadTargetNodeIdInvalid)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadDuplicateReferenceNotAllowed)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadInvalidSelfReference)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadReferenceLocalOnly)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadNoDeleteRights)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(UncertainReferenceNotDeleted)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadServerIndexInvalid)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadViewIdUnknown)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadViewTimestampInvalid)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadViewParameterMismatch)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadViewVersionInvalid)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(UncertainNotAllNodesAvailable)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(GoodResultsMayBeIncomplete)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadNotTypeDefinition)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(UncertainReferenceOutOfServer)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadTooManyMatches)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadQueryTooComplex)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadNoMatch)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadMaxAgeInvalid)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadHistoryOperationInvalid)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadHistoryOperationUnsupported)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadInvalidTimestampArgument)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadWriteNotSupported)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadTypeMismatch)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadMethodInvalid)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadArgumentsMissing)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadTooManySubscriptions)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadTooManyPublishRequests)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadNoSubscription)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadSequenceNumberUnknown)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadMessageNotAvailable)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadInsufficientClientProfile)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadStateNotActive)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadTcpServerTooBusy)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadTcpMessageTypeInvalid)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadTcpSecureChannelUnknown)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadTcpMessageTooLarge)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadTcpNotEnoughResources)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadTcpInternalError)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadTcpEndpointUrlInvalid)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadRequestInterrupted)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadRequestTimeout)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadSecureChannelClosed)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadSecureChannelTokenUnknown)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadSequenceNumberInvalid)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadProtocolVersionUnsupported)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadConfigurationError)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadNotConnected)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadDeviceFailure)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadSensorFailure)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadOutOfService)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadDeadbandFilterInvalid)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(UncertainNoCommunicationLastUsableValue)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(UncertainLastUsableValue)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(UncertainSubstituteValue)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(UncertainInitialValue)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(UncertainSensorNotAccurate)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(UncertainEngineeringUnitsExceeded)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(UncertainSubNormal)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(GoodLocalOverride)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadRefreshInProgress)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadConditionAlreadyDisabled)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadConditionAlreadyEnabled)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadConditionDisabled)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadEventIdUnknown)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadEventNotAcknowledgeable)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadDialogNotActive)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadDialogResponseInvalid)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadConditionBranchAlreadyAcked)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadConditionBranchAlreadyConfirmed)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadConditionAlreadyShelved)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadConditionNotShelved)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadShelvingTimeOutOfRange)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadNoData)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadBoundNotFound)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadBoundNotSupported)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadDataLost)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadDataUnavailable)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadEntryExists)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadNoEntryExists)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadTimestampNotSupported)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(GoodEntryInserted)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(GoodEntryReplaced)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(UncertainDataSubNormal)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(GoodNoData)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(GoodMoreData)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadAggregateListMismatch)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadAggregateNotSupported)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadAggregateInvalidInputs)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadAggregateConfigurationRejected)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(GoodDataIgnored)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(GoodCommunicationEvent)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(GoodShutdownEvent)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(GoodCallAgain)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(GoodNonCriticalTimeout)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadInvalidArgument)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadConnectionRejected)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadDisconnect)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadConnectionClosed)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadInvalidState)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadEndOfStream)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadNoDataAvailable)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadWaitingForResponse)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadOperationAbandoned)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadExpectedStreamToBlock)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadWouldBlock)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadSyntaxError)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadMaxConnectionsReached)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(NoStatusError)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadStatusError)
                        TECHNOSOFTWARE_STATUSCODES_TOSTRING(BadLicenseExpired)
                default:
                    return "UNKNOWN!";
                }
            }
        }
    }
}
